<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>sigwait</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_008_759">&nbsp;</a>NAME</h4><blockquote>
sigwait - wait for queued signals
</blockquote><h4><a name = "tag_000_008_760">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="signal.h.html">signal.h</a>&gt;

int sigwait(const sigset_t *<i>set</i>, int *<i>sig</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_008_761">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>sigwait()</i>
function selects a pending signal from
<i>set</i>,
atomically clears it from the
system's set of pending signals,
and returns that signal number in the location referenced by
<i>sig</i>.
If prior to the call to
<i>sigwait()</i>
there are multiple pending instances of a single signal number,
it is implementation-dependent
whether upon successful return there are any remaining pending
signals for that signal number.
If the implementation supports queued signals and
there are multiple signals queued for the signal number selected,
the first such queued signal causes a return from
<i>sigwait()</i>
and the remainder remain queued.
If no signal in
<i>set</i>
is pending at the time of the call,
the thread is suspended until one or more becomes pending.
The signals defined by
<i>set</i>
will been blocked at the time of the call to
<i>sigwait()</i>;
otherwise the behaviour is undefined.
The effect of
<i>sigwait()</i>
on the signal actions for the signals in
<i>set</i>
is unspecified.
<p>
If more than one thread is using
<i>sigwait()</i>
to wait for the same signal,
no more than one of these threads will return from
<i>sigwait()</i>
with the signal number.
Which thread returns from
<i>sigwait()</i>
if more than a single thread is waiting is unspecified.
<p>
Should any of the multiple pending signals in the range SIGRTMIN to
SIGRTMAX be selected, it shall be the lowest numbered one.
The selection order between realtime and non-realtime signals, or
between multiple pending non-realtime signals, is unspecified.
</blockquote><h4><a name = "tag_000_008_762">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>sigwait()</i>
stores the signal number of the received signal
at the location referenced by
<i>sig</i>
and returns zero.
Otherwise, an error number is returned to indicate the error.
</blockquote><h4><a name = "tag_000_008_763">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>sigwait()</i>
function may fail if:
<dl compact>

<dt>[EINVAL]<dd>
The
<i>set</i>
argument contains an invalid or unsupported signal number.

</dl>
</blockquote><h4><a name = "tag_000_008_764">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_765">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_766">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_767">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="pause.html">pause()</a></i>,
<i><a href="pthread_sigmask.html">pthread_sigmask()</a></i>,
<i><a href="sigaction.html">sigaction()</a></i>,
<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>,
<i><a href="sigpending.html">sigpending()</a></i>,
<i><a href="sigsuspend.html">sigsuspend()</a></i>,
<i><a href="sigwaitinfo.html">sigwaitinfo()</a></i>,
<i><a href="time.h.html">&lt;time.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995) and the POSIX Threads Extension (1003.1c-1995)
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

